<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>灰名单统计</title>

<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" language="javascript" src="../script/common_stat.js"></script>

<script type="text/javascript">
	var crosstab = new Crosstab();
	//occurTime:{name:"灰交易产生时间",option:{year:"年",quarter:"季度",month:"月份"}},
	var dimensions = {"org":{name:"所属机构",option:{"p200":"省大区","p500":"地市"}},"terminalId":"PSAM终端号","accountType":"交易账户类型"}
	var measures = {"count":"交易笔数",sum:"交易总额"}

	var defaultHorizon = {"org":{"p200":true,"p500":true},"terminalId":true}
	var defaultVertical = {"accountType":true}
	var defaultMeasure = {"count":true,"sum":true}
	var crossconf = {
		dimensions : dimensions,
		measures : measures,
		defaultMeasure : defaultMeasure,
		defaultVertical : defaultVertical,
		defaultHorizon : defaultHorizon
	}
	var cc;
	var pivot;
	function load(){
		Eui.showNavigation();
		setPages(["queryView","crosstabview"]);
		
		Common.initDict(statForm.accountType,"base_account_unit","全 部");         //初始化字典 			
	 	pivot = new Pivot("crosstabview","gray_card_stat");		
		pivot.initConf(crossconf)
		pivot.setPivotHead('pivotTitle','灰名单统计表');
		Eui.initBeginDateInput("beginDateTd","起始日期","statForm","beginDate","endDate","_pastDate",true);
		Eui.initEndDateInput("endDateTd","结束日期","statForm","beginDate","endDate","_pastDate",true);
	}
 
	//选择机构方法
	function searchSelOrg(){
		SystemMgnt.selOrg(function(sorg) {
				statForm.orgName.value = sorg.name;
				statForm.orgP.value = sorg.orgLevel
				statForm.orgId.value = sorg.id
			},{funcType : Constants.SELORG_ALL});
	}


	function doQuery(){
		if(!checkForm(statForm))
			return;
		pivot.param = paramFunc();
		
		pivot.setPivotHead('statTime',Format.today(true));
		pivot.setPivotHead('statClass',"无");
		pivot.setPivotHead('beginTime',pivot.param.beginDate);
		pivot.setPivotHead('endTime',pivot.param.endDate);
		pivot.refresh();
		switchPage("crosstabview");	
		
	}
	function paramFunc(){
		var cOrg = Common.cOrg()
		statForm.currentOrg.value = cOrg.id;
		statForm.currentOrgLevel.value = cOrg.orgLevel;
		return Common.getValues(statForm);
	}
</script>
</head>

<body onload="load()">
	<div class="nav"><div id="nav">&nbsp;</div></div>
		<!--查询静态页面部分-->
		<div id="queryView">	
			<!--查询条件form-->
			<div class="searchForm">
				<form id = "statForm" name="statForm">
					<input type="hidden" name="currentOrg"/>
					<input type="hidden" name="currentOrgLevel"/>
					<input type="hidden" name="orgP"/>
					<input type="hidden" name="orgId"/>
					<table cellSpacing=0 cellPadding=4 width="100%" border=0 class="col3 label6">
						<tr>
		<td id="beginDateTd"> </td>
		<td id="endDateTd"></td>
						</tr>
						<tr>
							<td>
								<label>所属机构</label> <input type="text" name="orgName" class="readonly" maxlength="20"> <a class="orga" title="选择所属机构" href="javascript:void(0)" onclick="searchSelOrg()">&nbsp;&nbsp;</a>
							</td>
							<td>
								<label>交易帐户类型</label> <select name="accountType"> </select>
							</td>
							
							<td><button type="button" onclick="doQuery()">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
		<div id="crosstabview" style="display:none;"></div>
		<div id="chartView" style="display:none;"></div>
		<!--统计结果显示部分-->
		<div id="pivotView" style="display:none;"></div>
</body>

</html>
